import 'package:flutter/material.dart';

/**
 * Widget Icon使用
 */
main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HYHomePage(),
    );
  }
}

class HYHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('基础Widge'),
      ),
      body: HYHomeContent(),
      floatingActionButton: FloatingActionButton(
          child: Icon(Icons.add),
          onPressed: () {
            print('FloatingActionButton click');
          }),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
    );
  }
}

class HYHomeContent extends StatefulWidget {
  @override
  _HYHomeContentState createState() => _HYHomeContentState();
}

class _HYHomeContentState extends State<HYHomeContent> {
  @override
  Widget build(BuildContext context) {
    return IconExtensionDemo();
  }
}


class IconExtensionDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //Icon字体图标和图片图标
    //1.字体图标矢量图(放大的时候不会失真)
    //2.字体图标可以设置颜色
    //3.图标很多时，占据控件更小
//    return Icon(Icons.pets, size: 300, color: Colors.orange);
//    return Icon(IconData(0xe0cd, fontFamily: 'MaterialIcons'),
//        size: 300, color: Colors.orange);
    //1.0xe0cd -> unicode编码
    return Text('\ue0cd',style: TextStyle(fontSize: 200,color: Colors.orange,fontFamily: 'MaterialIcons'),);
  }
}
